from rest_framework import serializers

from course import models


class CateSer(serializers.ModelSerializer):
    class Meta:
        model = models.CategoryModel
        fields = ["id", "name"]


class CategorySer(serializers.ModelSerializer):
    son = CateSer(many=True)

    class Meta:
        model = models.CategoryModel
        fields = ["id",'name', "son"]


class CourseSer(serializers.ModelSerializer):
    class Meta:
        model = models.CourseModel
        fields = "__all__"


class TeacherSer(serializers.ModelSerializer):
    class Meta:
        model = models.TeacherModel
        fields = "__all__"